
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/physics/secondquant.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:27:48 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Second Quantization &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="secondquant.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Wigner Symbols" href="wigner.html" />
    <link rel="prev" title="Quantum Harmonic Oscillator in 3-D" href="sho.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="wigner.html" title="Wigner Symbols"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="sho.html" title="Quantum Harmonic Oscillator in 3-D"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Physics</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Second Quantization</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-sympy.physics.secondquant">
<span id="second-quantization"></span><h1>Second Quantization<a class="headerlink" href="#module-sympy.physics.secondquant" title="Permalink to this headline">¶</a></h1>
<p>Second quantization operators and states for bosons.</p>
<p>This follow the formulation of Fetter and Welecka, “Quantum Theory
of Many-Particle Systems.”</p>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AnnihilateBoson">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">AnnihilateBoson</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">k</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L397-L442"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.AnnihilateBoson" title="Permalink to this definition">¶</a></dt>
<dd><p>Bosonic annihilation operator.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">B</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">B</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
<span class="go">AnnihilateBoson(x)</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AnnihilateBoson.apply_operator">
<span class="sig-name descname"><span class="pre">apply_operator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">state</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L415-L436"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.AnnihilateBoson.apply_operator" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply state to self if self is not symbolic and state is a FockStateKet, else
multiply self by state.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">B</span><span class="p">,</span> <span class="n">BKet</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">n</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">B</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">apply_operator</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
<span class="go">y*AnnihilateBoson(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">B</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">apply_operator</span><span class="p">(</span><span class="n">BKet</span><span class="p">((</span><span class="n">n</span><span class="p">,)))</span>
<span class="go">sqrt(n)*FockStateBosonKet((n - 1,))</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AnnihilateFermion">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">AnnihilateFermion</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">k</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L650-L796"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.AnnihilateFermion" title="Permalink to this definition">¶</a></dt>
<dd><p>Fermionic annihilation operator.</p>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AnnihilateFermion.apply_operator">
<span class="sig-name descname"><span class="pre">apply_operator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">state</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L660-L688"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.AnnihilateFermion.apply_operator" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply state to self if self is not symbolic and state is a FockStateKet, else
multiply self by state.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">B</span><span class="p">,</span> <span class="n">Dagger</span><span class="p">,</span> <span class="n">BKet</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">n</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dagger</span><span class="p">(</span><span class="n">B</span><span class="p">(</span><span class="n">x</span><span class="p">))</span><span class="o">.</span><span class="n">apply_operator</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
<span class="go">y*CreateBoson(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">B</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">apply_operator</span><span class="p">(</span><span class="n">BKet</span><span class="p">((</span><span class="n">n</span><span class="p">,)))</span>
<span class="go">sqrt(n)*FockStateBosonKet((n - 1,))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AnnihilateFermion.is_only_q_annihilator">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_only_q_annihilator</span></span><a class="headerlink" href="#sympy.physics.secondquant.AnnihilateFermion.is_only_q_annihilator" title="Permalink to this definition">¶</a></dt>
<dd><p>Always destroy a quasi-particle?  (annihilate hole or annihilate particle)</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">F</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_annihilator</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_annihilator</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_annihilator</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AnnihilateFermion.is_only_q_creator">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_only_q_creator</span></span><a class="headerlink" href="#sympy.physics.secondquant.AnnihilateFermion.is_only_q_creator" title="Permalink to this definition">¶</a></dt>
<dd><p>Always create a quasi-particle?  (create hole or create particle)</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">F</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_creator</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_creator</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_creator</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AnnihilateFermion.is_q_annihilator">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_q_annihilator</span></span><a class="headerlink" href="#sympy.physics.secondquant.AnnihilateFermion.is_q_annihilator" title="Permalink to this definition">¶</a></dt>
<dd><p>Can we destroy a quasi-particle?  (annihilate hole or annihilate particle)
If so, would that be above or below the fermi surface?</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">F</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_annihilator</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_annihilator</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_annihilator</span>
<span class="go">1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AnnihilateFermion.is_q_creator">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_q_creator</span></span><a class="headerlink" href="#sympy.physics.secondquant.AnnihilateFermion.is_q_creator" title="Permalink to this definition">¶</a></dt>
<dd><p>Can we create a quasi-particle?  (create hole or create particle)
If so, would that be above or below the fermi surface?</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">F</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_creator</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_creator</span>
<span class="go">-1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">F</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_creator</span>
<span class="go">-1</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AntiSymmetricTensor">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">AntiSymmetricTensor</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">symbol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">upper</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lower</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L153-L305"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.AntiSymmetricTensor" title="Permalink to this definition">¶</a></dt>
<dd><p>Stores upper and lower indices in separate Tuple’s.</p>
<p>Each group of indices is assumed to be antisymmetric.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">AntiSymmetricTensor</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span> <span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AntiSymmetricTensor</span><span class="p">(</span><span class="s1">&#39;v&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">i</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span>
<span class="go">AntiSymmetricTensor(v, (a, i), (b, j))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AntiSymmetricTensor</span><span class="p">(</span><span class="s1">&#39;v&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">a</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span>
<span class="go">-AntiSymmetricTensor(v, (a, i), (b, j))</span>
</pre></div>
</div>
<p>As you can see, the indices are automatically sorted to a canonical form.</p>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AntiSymmetricTensor.doit">
<span class="sig-name descname"><span class="pre">doit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kw_args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L291-L305"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.AntiSymmetricTensor.doit" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns self.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">AntiSymmetricTensor</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span> <span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i,j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a,b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AntiSymmetricTensor</span><span class="p">(</span><span class="s1">&#39;v&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">i</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span><span class="o">.</span><span class="n">doit</span><span class="p">()</span>
<span class="go">AntiSymmetricTensor(v, (a, i), (b, j))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AntiSymmetricTensor.lower">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">lower</span></span><a class="headerlink" href="#sympy.physics.secondquant.AntiSymmetricTensor.lower" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the lower indices.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">AntiSymmetricTensor</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span> <span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i,j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a,b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AntiSymmetricTensor</span><span class="p">(</span><span class="s1">&#39;v&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">i</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span>
<span class="go">AntiSymmetricTensor(v, (a, i), (b, j))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AntiSymmetricTensor</span><span class="p">(</span><span class="s1">&#39;v&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">i</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span><span class="o">.</span><span class="n">lower</span>
<span class="go">(b, j)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AntiSymmetricTensor.symbol">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">symbol</span></span><a class="headerlink" href="#sympy.physics.secondquant.AntiSymmetricTensor.symbol" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the symbol of the tensor.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">AntiSymmetricTensor</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span> <span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i,j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a,b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AntiSymmetricTensor</span><span class="p">(</span><span class="s1">&#39;v&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">i</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span>
<span class="go">AntiSymmetricTensor(v, (a, i), (b, j))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AntiSymmetricTensor</span><span class="p">(</span><span class="s1">&#39;v&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">i</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span><span class="o">.</span><span class="n">symbol</span>
<span class="go">v</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.AntiSymmetricTensor.upper">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">upper</span></span><a class="headerlink" href="#sympy.physics.secondquant.AntiSymmetricTensor.upper" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the upper indices.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">AntiSymmetricTensor</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span> <span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i,j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a,b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AntiSymmetricTensor</span><span class="p">(</span><span class="s1">&#39;v&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">i</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span>
<span class="go">AntiSymmetricTensor(v, (a, i), (b, j))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AntiSymmetricTensor</span><span class="p">(</span><span class="s1">&#39;v&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">i</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span><span class="o">.</span><span class="n">upper</span>
<span class="go">(a, i)</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="sympy.physics.secondquant.B">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">B</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L397-L442"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.B" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#sympy.physics.secondquant.AnnihilateBoson" title="sympy.physics.secondquant.AnnihilateBoson"><code class="xref py py-class docutils literal notranslate"><span class="pre">sympy.physics.secondquant.AnnihilateBoson</span></code></a></p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="sympy.physics.secondquant.BBra">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">BBra</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1278-L1290"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.BBra" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#sympy.physics.secondquant.FockStateBosonBra" title="sympy.physics.secondquant.FockStateBosonBra"><code class="xref py py-class docutils literal notranslate"><span class="pre">sympy.physics.secondquant.FockStateBosonBra</span></code></a></p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="sympy.physics.secondquant.BKet">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">BKet</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1261-L1275"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.BKet" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#sympy.physics.secondquant.FockStateBosonKet" title="sympy.physics.secondquant.FockStateBosonKet"><code class="xref py py-class docutils literal notranslate"><span class="pre">sympy.physics.secondquant.FockStateBosonKet</span></code></a></p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="sympy.physics.secondquant.Bd">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">Bd</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L445-L481"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.Bd" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#sympy.physics.secondquant.CreateBoson" title="sympy.physics.secondquant.CreateBoson"><code class="xref py py-class docutils literal notranslate"><span class="pre">sympy.physics.secondquant.CreateBoson</span></code></a></p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.BosonicBasis">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">BosonicBasis</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1501-L1505"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.BosonicBasis" title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for a basis set of bosonic Fock states.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.Commutator">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">Commutator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">a</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1657-L1802"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.Commutator" title="Permalink to this definition">¶</a></dt>
<dd><p>The Commutator:  [A, B] = A*B - B*A</p>
<p>The arguments are ordered according to .__cmp__()</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Commutator</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span><span class="p">,</span> <span class="n">B</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;A,B&#39;</span><span class="p">,</span> <span class="n">commutative</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Commutator</span><span class="p">(</span><span class="n">B</span><span class="p">,</span> <span class="n">A</span><span class="p">)</span>
<span class="go">-Commutator(A, B)</span>
</pre></div>
</div>
<p>Evaluate the commutator with .doit()</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">comm</span> <span class="o">=</span> <span class="n">Commutator</span><span class="p">(</span><span class="n">A</span><span class="p">,</span><span class="n">B</span><span class="p">);</span> <span class="n">comm</span>
<span class="go">Commutator(A, B)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">comm</span><span class="o">.</span><span class="n">doit</span><span class="p">()</span>
<span class="go">A*B - B*A</span>
</pre></div>
</div>
<p>For two second quantization operators the commutator is evaluated
immediately:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Fd</span><span class="p">,</span> <span class="n">F</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span><span class="n">q</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p,q&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Commutator</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">),</span><span class="n">Fd</span><span class="p">(</span><span class="n">i</span><span class="p">))</span>
<span class="go">2*NO(CreateFermion(a)*CreateFermion(i))</span>
</pre></div>
</div>
<p>But for more complicated expressions, the evaluation is triggered by
a call to .doit()</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">comm</span> <span class="o">=</span> <span class="n">Commutator</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">Fd</span><span class="p">(</span><span class="n">q</span><span class="p">),</span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">));</span> <span class="n">comm</span>
<span class="go">Commutator(CreateFermion(p)*CreateFermion(q), AnnihilateFermion(i))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">comm</span><span class="o">.</span><span class="n">doit</span><span class="p">(</span><span class="n">wicks</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="go">-KroneckerDelta(i, p)*CreateFermion(q) +</span>
<span class="go"> KroneckerDelta(i, q)*CreateFermion(p)</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.Commutator.doit">
<span class="sig-name descname"><span class="pre">doit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">hints</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1764-L1792"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.Commutator.doit" title="Permalink to this definition">¶</a></dt>
<dd><p>Enables the computation of complex expressions.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Commutator</span><span class="p">,</span> <span class="n">F</span><span class="p">,</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span> <span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i,j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a,b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="n">Commutator</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">),</span><span class="n">Fd</span><span class="p">(</span><span class="n">b</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">j</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span><span class="o">.</span><span class="n">doit</span><span class="p">(</span><span class="n">wicks</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="go">0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.Commutator.eval">
<em class="property"><span class="pre">classmethod</span> </em><span class="sig-name descname"><span class="pre">eval</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">a</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1704-L1762"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.Commutator.eval" title="Permalink to this definition">¶</a></dt>
<dd><p>The Commutator [A,B] is on canonical form if A &lt; B.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Commutator</span><span class="p">,</span> <span class="n">F</span><span class="p">,</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c1</span> <span class="o">=</span> <span class="n">Commutator</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">Fd</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c2</span> <span class="o">=</span> <span class="n">Commutator</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">F</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Commutator</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">c1</span><span class="p">,</span> <span class="n">c2</span><span class="p">)</span>
<span class="go">0</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.CreateBoson">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">CreateBoson</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">k</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L445-L481"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.CreateBoson" title="Permalink to this definition">¶</a></dt>
<dd><p>Bosonic creation operator.</p>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.CreateBoson.apply_operator">
<span class="sig-name descname"><span class="pre">apply_operator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">state</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L455-L475"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.CreateBoson.apply_operator" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply state to self if self is not symbolic and state is a FockStateKet, else
multiply self by state.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">B</span><span class="p">,</span> <span class="n">Dagger</span><span class="p">,</span> <span class="n">BKet</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">n</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dagger</span><span class="p">(</span><span class="n">B</span><span class="p">(</span><span class="n">x</span><span class="p">))</span><span class="o">.</span><span class="n">apply_operator</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
<span class="go">y*CreateBoson(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">B</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">apply_operator</span><span class="p">(</span><span class="n">BKet</span><span class="p">((</span><span class="n">n</span><span class="p">,)))</span>
<span class="go">sqrt(n)*FockStateBosonKet((n - 1,))</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.CreateFermion">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">CreateFermion</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">k</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L799-L942"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.CreateFermion" title="Permalink to this definition">¶</a></dt>
<dd><p>Fermionic creation operator.</p>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.CreateFermion.apply_operator">
<span class="sig-name descname"><span class="pre">apply_operator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">state</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L809-L834"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.CreateFermion.apply_operator" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply state to self if self is not symbolic and state is a FockStateKet, else
multiply self by state.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">B</span><span class="p">,</span> <span class="n">Dagger</span><span class="p">,</span> <span class="n">BKet</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">n</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dagger</span><span class="p">(</span><span class="n">B</span><span class="p">(</span><span class="n">x</span><span class="p">))</span><span class="o">.</span><span class="n">apply_operator</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
<span class="go">y*CreateBoson(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">B</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">apply_operator</span><span class="p">(</span><span class="n">BKet</span><span class="p">((</span><span class="n">n</span><span class="p">,)))</span>
<span class="go">sqrt(n)*FockStateBosonKet((n - 1,))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.CreateFermion.is_only_q_annihilator">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_only_q_annihilator</span></span><a class="headerlink" href="#sympy.physics.secondquant.CreateFermion.is_only_q_annihilator" title="Permalink to this definition">¶</a></dt>
<dd><p>Always destroy a quasi-particle?  (annihilate hole or annihilate particle)</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_annihilator</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_annihilator</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_annihilator</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.CreateFermion.is_only_q_creator">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_only_q_creator</span></span><a class="headerlink" href="#sympy.physics.secondquant.CreateFermion.is_only_q_creator" title="Permalink to this definition">¶</a></dt>
<dd><p>Always create a quasi-particle?  (create hole or create particle)</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_creator</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_creator</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_q_creator</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.CreateFermion.is_q_annihilator">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_q_annihilator</span></span><a class="headerlink" href="#sympy.physics.secondquant.CreateFermion.is_q_annihilator" title="Permalink to this definition">¶</a></dt>
<dd><p>Can we destroy a quasi-particle?  (annihilate hole or annihilate particle)
If so, would that be above or below the fermi surface?</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_annihilator</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_annihilator</span>
<span class="go">-1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_annihilator</span>
<span class="go">-1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.CreateFermion.is_q_creator">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_q_creator</span></span><a class="headerlink" href="#sympy.physics.secondquant.CreateFermion.is_q_creator" title="Permalink to this definition">¶</a></dt>
<dd><p>Can we create a quasi-particle?  (create hole or create particle)
If so, would that be above or below the fermi surface?</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_creator</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_creator</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">is_q_creator</span>
<span class="go">1</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.Dagger">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">Dagger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arg</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L81-L145"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.Dagger" title="Permalink to this definition">¶</a></dt>
<dd><p>Hermitian conjugate of creation/annihilation operators.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">I</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Dagger</span><span class="p">,</span> <span class="n">B</span><span class="p">,</span> <span class="n">Bd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dagger</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">I</span><span class="p">)</span>
<span class="go">-2*I</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dagger</span><span class="p">(</span><span class="n">B</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go">CreateBoson(0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dagger</span><span class="p">(</span><span class="n">Bd</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go">AnnihilateBoson(0)</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.Dagger.eval">
<em class="property"><span class="pre">classmethod</span> </em><span class="sig-name descname"><span class="pre">eval</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arg</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L107-L142"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.Dagger.eval" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluates the Dagger instance.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">I</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">Dagger</span><span class="p">,</span> <span class="n">B</span><span class="p">,</span> <span class="n">Bd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dagger</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">I</span><span class="p">)</span>
<span class="go">-2*I</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dagger</span><span class="p">(</span><span class="n">B</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go">CreateBoson(0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dagger</span><span class="p">(</span><span class="n">Bd</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go">AnnihilateBoson(0)</span>
</pre></div>
</div>
<p>The eval() method is called automatically.</p>
</dd></dl>

</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="sympy.physics.secondquant.F">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">F</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L650-L796"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.F" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#sympy.physics.secondquant.AnnihilateFermion" title="sympy.physics.secondquant.AnnihilateFermion"><code class="xref py py-class docutils literal notranslate"><span class="pre">sympy.physics.secondquant.AnnihilateFermion</span></code></a></p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FBra">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FBra</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1320-L1335"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FBra" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#sympy.physics.secondquant.FockStateFermionBra" title="sympy.physics.secondquant.FockStateFermionBra"><code class="xref py py-class docutils literal notranslate"><span class="pre">sympy.physics.secondquant.FockStateFermionBra</span></code></a></p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FKet">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FKet</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1293-L1317"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FKet" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#sympy.physics.secondquant.FockStateFermionKet" title="sympy.physics.secondquant.FockStateFermionKet"><code class="xref py py-class docutils literal notranslate"><span class="pre">sympy.physics.secondquant.FockStateFermionKet</span></code></a></p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="sympy.physics.secondquant.Fd">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">Fd</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L799-L942"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.Fd" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#sympy.physics.secondquant.CreateFermion" title="sympy.physics.secondquant.CreateFermion"><code class="xref py py-class docutils literal notranslate"><span class="pre">sympy.physics.secondquant.CreateFermion</span></code></a></p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FixedBosonicBasis">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FixedBosonicBasis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n_particles</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n_levels</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1575-L1654"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FixedBosonicBasis" title="Permalink to this definition">¶</a></dt>
<dd><p>Fixed particle number basis set.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">FixedBosonicBasis</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">FixedBosonicBasis</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">state</span> <span class="o">=</span> <span class="n">b</span><span class="o">.</span><span class="n">state</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span>
<span class="go">[FockState((2, 0)), FockState((1, 1)), FockState((0, 2))]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">state</span>
<span class="go">FockStateBosonKet((1, 1))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
<span class="go">1</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FixedBosonicBasis.index">
<span class="sig-name descname"><span class="pre">index</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">state</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1621-L1632"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FixedBosonicBasis.index" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the index of state in basis.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">FixedBosonicBasis</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">FixedBosonicBasis</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">b</span><span class="o">.</span><span class="n">state</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
<span class="go">3</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FixedBosonicBasis.state">
<span class="sig-name descname"><span class="pre">state</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1634-L1645"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FixedBosonicBasis.state" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the state that lies at index i of the basis</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">FixedBosonicBasis</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">FixedBosonicBasis</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">state</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="go">FockStateBosonKet((1, 0, 1))</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FockState">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FockState</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">occupations</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L948-L988"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FockState" title="Permalink to this definition">¶</a></dt>
<dd><p>Many particle Fock state with a sequence of occupation numbers.</p>
<p>Anywhere you can have a FockState, you can also have S.Zero.
All code must check for this!</p>
<p>Base class to represent FockStates.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FockStateBosonBra">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FockStateBosonBra</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">occupations</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1278-L1290"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FockStateBosonBra" title="Permalink to this definition">¶</a></dt>
<dd><p>Describes a collection of BosonBra particles.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">BBra</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">BBra</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="go">FockStateBosonBra((1, 2))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FockStateBosonKet">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FockStateBosonKet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">occupations</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1261-L1275"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FockStateBosonKet" title="Permalink to this definition">¶</a></dt>
<dd><p>Many particle Fock state with a sequence of occupation numbers.</p>
<p>Occupation numbers can be any integer &gt;= 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">BKet</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">BKet</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="go">FockStateBosonKet((1, 2))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FockStateBra">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FockStateBra</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">occupations</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1247-L1258"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FockStateBra" title="Permalink to this definition">¶</a></dt>
<dd><p>Representation of a bra.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FockStateFermionBra">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FockStateFermionBra</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">occupations</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fermi_level</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1320-L1335"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FockStateFermionBra" title="Permalink to this definition">¶</a></dt>
<dd><p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">FBra</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">FBra</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="go">FockStateFermionBra((1, 2))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.physics.secondquant.FockStateFermionKet" title="sympy.physics.secondquant.FockStateFermionKet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FockStateFermionKet</span></code></a></p>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FockStateFermionKet">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FockStateFermionKet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">occupations</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fermi_level</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1293-L1317"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FockStateFermionKet" title="Permalink to this definition">¶</a></dt>
<dd><p>Many-particle Fock state with a sequence of occupied orbits.</p>
<p class="rubric">Explanation</p>
<p>Each state can only have one particle, so we choose to store a list of
occupied orbits rather than a tuple with occupation numbers (zeros and ones).</p>
<p>states below fermi level are holes, and are represented by negative labels
in the occupation list.</p>
<p>For symbolic state labels, the fermi_level caps the number of allowed hole-
states.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">FKet</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">FKet</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="go">FockStateFermionKet((1, 2))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.FockStateKet">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">FockStateKet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">occupations</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1239-L1244"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.FockStateKet" title="Permalink to this definition">¶</a></dt>
<dd><p>Representation of a ket.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.InnerProduct">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">InnerProduct</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bra</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ket</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1426-L1473"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.InnerProduct" title="Permalink to this definition">¶</a></dt>
<dd><p>An unevaluated inner product between a bra and ket.</p>
<p class="rubric">Explanation</p>
<p>Currently this class just reduces things to a product of
Kronecker Deltas.  In the future, we could introduce abstract
states like <code class="docutils literal notranslate"><span class="pre">|a&gt;</span></code> and <code class="docutils literal notranslate"><span class="pre">|b&gt;</span></code>, and leave the inner product unevaluated as
<code class="docutils literal notranslate"><span class="pre">&lt;a|b&gt;</span></code>.</p>
<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.InnerProduct.bra">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">bra</span></span><a class="headerlink" href="#sympy.physics.secondquant.InnerProduct.bra" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the bra part of the state</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.InnerProduct.ket">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">ket</span></span><a class="headerlink" href="#sympy.physics.secondquant.InnerProduct.ket" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the ket part of the state</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.KroneckerDelta">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">KroneckerDelta</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">delta_range</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/functions/special/tensor_functions.py#L86-L479"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.KroneckerDelta" title="Permalink to this definition">¶</a></dt>
<dd><p>The discrete, or Kronecker, delta function.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>i</strong> : Number, Symbol</p>
<blockquote>
<div><p>The first index of the delta function.</p>
</div></blockquote>
<p><strong>j</strong> : Number, Symbol</p>
<blockquote>
<div><p>The second index of the delta function.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>A function that takes in two integers <span class="math notranslate nohighlight">\(i\)</span> and <span class="math notranslate nohighlight">\(j\)</span>. It returns <span class="math notranslate nohighlight">\(0\)</span> if <span class="math notranslate nohighlight">\(i\)</span>
and <span class="math notranslate nohighlight">\(j\)</span> are not equal, or it returns <span class="math notranslate nohighlight">\(1\)</span> if <span class="math notranslate nohighlight">\(i\)</span> and <span class="math notranslate nohighlight">\(j\)</span> are equal.</p>
<p class="rubric">Examples</p>
<p>An example with integer indices:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.functions.special.tensor_functions</span> <span class="kn">import</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">1</span>
</pre></div>
</div>
<p>Symbolic indices:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">k</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">)</span>
<span class="go">KroneckerDelta(i, j)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">k</span><span class="p">)</span>
<span class="go">KroneckerDelta(i, i + k + 1)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.eval" title="sympy.physics.secondquant.KroneckerDelta.eval"><code class="xref py py-obj docutils literal notranslate"><span class="pre">eval</span></code></a>, <a class="reference internal" href="../functions/special.html#sympy.functions.special.delta_functions.DiracDelta" title="sympy.functions.special.delta_functions.DiracDelta"><code class="xref py py-obj docutils literal notranslate"><span class="pre">DiracDelta</span></code></a></p>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r642"><span class="brackets"><a class="fn-backref" href="#id1">R642</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Kronecker_delta">https://en.wikipedia.org/wiki/Kronecker_delta</a></p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.KroneckerDelta.eval">
<em class="property"><span class="pre">classmethod</span> </em><span class="sig-name descname"><span class="pre">eval</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">delta_range</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/functions/special/tensor_functions.py#L142-L196"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.KroneckerDelta.eval" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluates the discrete delta function.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.functions.special.tensor_functions</span> <span class="kn">import</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">k</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">)</span>
<span class="go">KroneckerDelta(i, j)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">k</span><span class="p">)</span>
<span class="go">KroneckerDelta(i, i + k + 1)</span>
</pre></div>
</div>
<p># indirect doctest</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.KroneckerDelta.indices_contain_equal_information">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">indices_contain_equal_information</span></span><a class="headerlink" href="#sympy.physics.secondquant.KroneckerDelta.indices_contain_equal_information" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns True if indices are either both above or below fermi.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.functions.special.tensor_functions</span> <span class="kn">import</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;q&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span><span class="o">.</span><span class="n">indices_contain_equal_information</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">q</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">indices_contain_equal_information</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">indices_contain_equal_information</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.KroneckerDelta.is_above_fermi">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_above_fermi</span></span><a class="headerlink" href="#sympy.physics.secondquant.KroneckerDelta.is_above_fermi" title="Permalink to this definition">¶</a></dt>
<dd><p>True if Delta can be non-zero above fermi.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.functions.special.tensor_functions</span> <span class="kn">import</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;q&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_above_fermi</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_above_fermi</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span><span class="o">.</span><span class="n">is_above_fermi</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_below_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_below_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_below_fermi</span></code></a>, <a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_only_below_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_only_below_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_only_below_fermi</span></code></a>, <a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_only_above_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_only_above_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_only_above_fermi</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.KroneckerDelta.is_below_fermi">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_below_fermi</span></span><a class="headerlink" href="#sympy.physics.secondquant.KroneckerDelta.is_below_fermi" title="Permalink to this definition">¶</a></dt>
<dd><p>True if Delta can be non-zero below fermi.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.functions.special.tensor_functions</span> <span class="kn">import</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;q&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_below_fermi</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_below_fermi</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span><span class="o">.</span><span class="n">is_below_fermi</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_above_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_above_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_above_fermi</span></code></a>, <a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_only_above_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_only_above_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_only_above_fermi</span></code></a>, <a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_only_below_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_only_below_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_only_below_fermi</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.KroneckerDelta.is_only_above_fermi">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_only_above_fermi</span></span><a class="headerlink" href="#sympy.physics.secondquant.KroneckerDelta.is_only_above_fermi" title="Permalink to this definition">¶</a></dt>
<dd><p>True if Delta is restricted to above fermi.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.functions.special.tensor_functions</span> <span class="kn">import</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;q&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_above_fermi</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_above_fermi</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_above_fermi</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_above_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_above_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_above_fermi</span></code></a>, <a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_below_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_below_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_below_fermi</span></code></a>, <a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_only_below_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_only_below_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_only_below_fermi</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.KroneckerDelta.is_only_below_fermi">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_only_below_fermi</span></span><a class="headerlink" href="#sympy.physics.secondquant.KroneckerDelta.is_only_below_fermi" title="Permalink to this definition">¶</a></dt>
<dd><p>True if Delta is restricted to below fermi.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.functions.special.tensor_functions</span> <span class="kn">import</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;q&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_below_fermi</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_below_fermi</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">is_only_below_fermi</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_above_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_above_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_above_fermi</span></code></a>, <a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_below_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_below_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_below_fermi</span></code></a>, <a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.is_only_above_fermi" title="sympy.physics.secondquant.KroneckerDelta.is_only_above_fermi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_only_above_fermi</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.KroneckerDelta.killable_index">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">killable_index</span></span><a class="headerlink" href="#sympy.physics.secondquant.KroneckerDelta.killable_index" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the index which is preferred to substitute in the final
expression.</p>
<p class="rubric">Explanation</p>
<p>The index to substitute is the index with less information regarding
fermi level. If indices contain the same information, ‘a’ is preferred
before ‘b’.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.functions.special.tensor_functions</span> <span class="kn">import</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">j</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">killable_index</span>
<span class="go">p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">killable_index</span>
<span class="go">p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">)</span><span class="o">.</span><span class="n">killable_index</span>
<span class="go">j</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.preferred_index" title="sympy.physics.secondquant.KroneckerDelta.preferred_index"><code class="xref py py-obj docutils literal notranslate"><span class="pre">preferred_index</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.KroneckerDelta.preferred_index">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">preferred_index</span></span><a class="headerlink" href="#sympy.physics.secondquant.KroneckerDelta.preferred_index" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the index which is preferred to keep in the final expression.</p>
<p class="rubric">Explanation</p>
<p>The preferred index is the index with more information regarding fermi
level. If indices contain the same information, ‘a’ is preferred before
‘b’.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.functions.special.tensor_functions</span> <span class="kn">import</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">j</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;p&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">preferred_index</span>
<span class="go">i</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">preferred_index</span>
<span class="go">a</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">)</span><span class="o">.</span><span class="n">preferred_index</span>
<span class="go">i</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.physics.secondquant.KroneckerDelta.killable_index" title="sympy.physics.secondquant.KroneckerDelta.killable_index"><code class="xref py py-obj docutils literal notranslate"><span class="pre">killable_index</span></code></a></p>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.NO">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">NO</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arg</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1805-L2143"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.NO" title="Permalink to this definition">¶</a></dt>
<dd><p>This Object is used to represent normal ordering brackets.</p>
<p>i.e.  {abcd}  sometimes written  :abcd:</p>
<p class="rubric">Explanation</p>
<p>Applying the function NO(arg) to an argument means that all operators in
the argument will be assumed to anticommute, and have vanishing
contractions.  This allows an immediate reordering to canonical form
upon object creation.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">NO</span><span class="p">,</span> <span class="n">F</span><span class="p">,</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span><span class="n">q</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p,q&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">NO</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">q</span><span class="p">))</span>
<span class="go">NO(CreateFermion(p)*AnnihilateFermion(q))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">NO</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">q</span><span class="p">)</span><span class="o">*</span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">))</span>
<span class="go">-NO(CreateFermion(p)*AnnihilateFermion(q))</span>
</pre></div>
</div>
<p class="rubric">Note</p>
<p>If you want to generate a normal ordered equivalent of an expression, you
should use the function wicks().  This class only indicates that all
operators inside the brackets anticommute, and have vanishing contractions.
Nothing more, nothing less.</p>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.NO.doit">
<span class="sig-name descname"><span class="pre">doit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kw_args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1963-L1986"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.NO.doit" title="Permalink to this definition">¶</a></dt>
<dd><p>Either removes the brackets or enables complex computations
in its arguments.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">NO</span><span class="p">,</span> <span class="n">Fd</span><span class="p">,</span> <span class="n">F</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">textwrap</span> <span class="kn">import</span> <span class="n">fill</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">Dummy</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span><span class="n">q</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p,q&#39;</span><span class="p">,</span> <span class="bp">cls</span><span class="o">=</span><span class="n">Dummy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">fill</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">NO</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">q</span><span class="p">))</span><span class="o">.</span><span class="n">doit</span><span class="p">())))</span>
<span class="go">KroneckerDelta(_a, _p)*KroneckerDelta(_a,</span>
<span class="go">_q)*CreateFermion(_a)*AnnihilateFermion(_a) + KroneckerDelta(_a,</span>
<span class="go">_p)*KroneckerDelta(_i, _q)*CreateFermion(_a)*AnnihilateFermion(_i) -</span>
<span class="go">KroneckerDelta(_a, _q)*KroneckerDelta(_i,</span>
<span class="go">_p)*AnnihilateFermion(_a)*CreateFermion(_i) - KroneckerDelta(_i,</span>
<span class="go">_p)*KroneckerDelta(_i, _q)*AnnihilateFermion(_i)*CreateFermion(_i)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.NO.get_subNO">
<span class="sig-name descname"><span class="pre">get_subNO</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L2117-L2134"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.NO.get_subNO" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a NO() without FermionicOperator at index i.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">F</span><span class="p">,</span> <span class="n">NO</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">r</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p,q,r&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">NO</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">q</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">r</span><span class="p">))</span><span class="o">.</span><span class="n">get_subNO</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="go">NO(AnnihilateFermion(p)*AnnihilateFermion(r))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.NO.has_q_annihilators">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">has_q_annihilators</span></span><a class="headerlink" href="#sympy.physics.secondquant.NO.has_q_annihilators" title="Permalink to this definition">¶</a></dt>
<dd><p>Return 0 if the rightmost argument of the first argument is a not a
q_annihilator, else 1 if it is above fermi or -1 if it is below fermi.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">NO</span><span class="p">,</span> <span class="n">F</span><span class="p">,</span> <span class="n">Fd</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">NO</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">*</span><span class="n">Fd</span><span class="p">(</span><span class="n">i</span><span class="p">))</span><span class="o">.</span><span class="n">has_q_annihilators</span>
<span class="go">-1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">NO</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">a</span><span class="p">))</span><span class="o">.</span><span class="n">has_q_annihilators</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">NO</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">))</span><span class="o">.</span><span class="n">has_q_annihilators</span>
<span class="go">0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.physics.secondquant.NO.has_q_creators">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">has_q_creators</span></span><a class="headerlink" href="#sympy.physics.secondquant.NO.has_q_creators" title="Permalink to this definition">¶</a></dt>
<dd><p>Return 0 if the leftmost argument of the first argument is a not a
q_creator, else 1 if it is above fermi or -1 if it is below fermi.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">NO</span><span class="p">,</span> <span class="n">F</span><span class="p">,</span> <span class="n">Fd</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">NO</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">*</span><span class="n">Fd</span><span class="p">(</span><span class="n">i</span><span class="p">))</span><span class="o">.</span><span class="n">has_q_creators</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">NO</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">a</span><span class="p">))</span><span class="o">.</span><span class="n">has_q_creators</span>
<span class="go">-1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">NO</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">a</span><span class="p">))</span><span class="o">.</span><span class="n">has_q_creators</span>           
<span class="go">0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.NO.iter_q_annihilators">
<span class="sig-name descname"><span class="pre">iter_q_annihilators</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L2058-L2085"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.NO.iter_q_annihilators" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterates over the annihilation operators.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span> <span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">NO</span><span class="p">,</span> <span class="n">F</span><span class="p">,</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">no</span> <span class="o">=</span> <span class="n">NO</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">b</span><span class="p">)</span><span class="o">*</span><span class="n">Fd</span><span class="p">(</span><span class="n">j</span><span class="p">))</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">no</span><span class="o">.</span><span class="n">iter_q_creators</span><span class="p">()</span>
<span class="go">&lt;generator object... at 0x...&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">no</span><span class="o">.</span><span class="n">iter_q_creators</span><span class="p">())</span>
<span class="go">[0, 1]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">no</span><span class="o">.</span><span class="n">iter_q_annihilators</span><span class="p">())</span>
<span class="go">[3, 2]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.NO.iter_q_creators">
<span class="sig-name descname"><span class="pre">iter_q_creators</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L2087-L2115"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.NO.iter_q_creators" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterates over the creation operators.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span> <span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">NO</span><span class="p">,</span> <span class="n">F</span><span class="p">,</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">no</span> <span class="o">=</span> <span class="n">NO</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">b</span><span class="p">)</span><span class="o">*</span><span class="n">Fd</span><span class="p">(</span><span class="n">j</span><span class="p">))</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">no</span><span class="o">.</span><span class="n">iter_q_creators</span><span class="p">()</span>
<span class="go">&lt;generator object... at 0x...&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">no</span><span class="o">.</span><span class="n">iter_q_creators</span><span class="p">())</span>
<span class="go">[0, 1]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">no</span><span class="o">.</span><span class="n">iter_q_annihilators</span><span class="p">())</span>
<span class="go">[3, 2]</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.PermutationOperator">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">PermutationOperator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">j</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L2973-L3013"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.PermutationOperator" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents the index permutation operator P(ij).</p>
<p>P(ij)*f(i)*g(j) = f(i)*g(j) - f(j)*g(i)</p>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.PermutationOperator.get_permuted">
<span class="sig-name descname"><span class="pre">get_permuted</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L2986-L3010"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.PermutationOperator.get_permuted" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns -expr with permuted indices.</p>
<p class="rubric">Explanation</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">Function</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">PermutationOperator</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span><span class="n">q</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p,q&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">PermutationOperator</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">)</span><span class="o">.</span><span class="n">get_permuted</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">))</span>
<span class="go">-f(q, p)</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.secondquant.VarBosonicBasis">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">VarBosonicBasis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n_max</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1508-L1572"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.VarBosonicBasis" title="Permalink to this definition">¶</a></dt>
<dd><p>A single state, variable particle number basis set.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">VarBosonicBasis</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">VarBosonicBasis</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span>
<span class="go">[FockState((0,)), FockState((1,)), FockState((2,)),</span>
<span class="go"> FockState((3,)), FockState((4,))]</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.VarBosonicBasis.index">
<span class="sig-name descname"><span class="pre">index</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">state</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1532-L1549"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.VarBosonicBasis.index" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the index of state in basis.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">VarBosonicBasis</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">VarBosonicBasis</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">state</span> <span class="o">=</span> <span class="n">b</span><span class="o">.</span><span class="n">state</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span>
<span class="go">[FockState((0,)), FockState((1,)), FockState((2,))]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">state</span>
<span class="go">FockStateBosonKet((1,))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
<span class="go">1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.secondquant.VarBosonicBasis.state">
<span class="sig-name descname"><span class="pre">state</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1551-L1563"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.VarBosonicBasis.state" title="Permalink to this definition">¶</a></dt>
<dd><p>The state of a single basis.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">VarBosonicBasis</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">VarBosonicBasis</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">state</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="go">FockStateBosonKet((3,))</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.physics.secondquant.apply_operators">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">apply_operators</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">e</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1408-L1423"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.apply_operators" title="Permalink to this definition">¶</a></dt>
<dd><p>Take a sympy expression with operators and states and apply the operators.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">apply_operators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">sympify</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">apply_operators</span><span class="p">(</span><span class="n">sympify</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">+</span><span class="mi">4</span><span class="p">)</span>
<span class="go">7</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.physics.secondquant.contraction">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">contraction</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">a</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L2146-L2215"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.contraction" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculates contraction of Fermionic operators a and b.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">F</span><span class="p">,</span> <span class="n">Fd</span><span class="p">,</span> <span class="n">contraction</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span> <span class="n">q</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p,q&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a,b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span> <span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i,j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<p>A contraction is non-zero only if a quasi-creator is to the right of a
quasi-annihilator:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">contraction</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">a</span><span class="p">),</span><span class="n">Fd</span><span class="p">(</span><span class="n">b</span><span class="p">))</span>
<span class="go">KroneckerDelta(a, b)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">contraction</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">i</span><span class="p">),</span><span class="n">F</span><span class="p">(</span><span class="n">j</span><span class="p">))</span>
<span class="go">KroneckerDelta(i, j)</span>
</pre></div>
</div>
<p>For general indices a non-zero result restricts the indices to below/above
the fermi surface:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">contraction</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">),</span><span class="n">F</span><span class="p">(</span><span class="n">q</span><span class="p">))</span>
<span class="go">KroneckerDelta(_i, q)*KroneckerDelta(p, q)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">contraction</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">p</span><span class="p">),</span><span class="n">Fd</span><span class="p">(</span><span class="n">q</span><span class="p">))</span>
<span class="go">KroneckerDelta(_a, q)*KroneckerDelta(p, q)</span>
</pre></div>
</div>
<p>Two creators or two annihilators always vanishes:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">contraction</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">p</span><span class="p">),</span><span class="n">F</span><span class="p">(</span><span class="n">q</span><span class="p">))</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">contraction</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">),</span><span class="n">Fd</span><span class="p">(</span><span class="n">q</span><span class="p">))</span>
<span class="go">0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.physics.secondquant.evaluate_deltas">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">evaluate_deltas</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">e</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L2279-L2387"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.evaluate_deltas" title="Permalink to this definition">¶</a></dt>
<dd><p>We evaluate KroneckerDelta symbols in the expression assuming Einstein summation.</p>
<p class="rubric">Explanation</p>
<p>If one index is repeated it is summed over and in effect substituted with
the other one. If both indices are repeated we substitute according to what
is the preferred index.  this is determined by
KroneckerDelta.preferred_index and KroneckerDelta.killable_index.</p>
<p>In case there are no possible substitutions or if a substitution would
imply a loss of information, nothing is done.</p>
<p>In case an index appears in more than one KroneckerDelta, the resulting
substitution depends on the order of the factors.  Since the ordering is platform
dependent, the literal expression resulting from this function may be hard to
predict.</p>
<p class="rubric">Examples</p>
<p>We assume the following:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">Function</span><span class="p">,</span> <span class="n">Dummy</span><span class="p">,</span> <span class="n">KroneckerDelta</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">evaluate_deltas</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span><span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="bp">cls</span><span class="o">=</span><span class="n">Dummy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span><span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a b&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="bp">cls</span><span class="o">=</span><span class="n">Dummy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span><span class="n">q</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p q&#39;</span><span class="p">,</span> <span class="bp">cls</span><span class="o">=</span><span class="n">Dummy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;t&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>The order of preference for these indices according to KroneckerDelta is
(a, b, i, j, p, q).</p>
<p>Trivial cases:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">i</span><span class="p">))</span>       <span class="c1"># d_ij f(i) -&gt; f(j)</span>
<span class="go">f(_j)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">j</span><span class="p">))</span>       <span class="c1"># d_ij f(j) -&gt; f(i)</span>
<span class="go">f(_i)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">))</span>       <span class="c1"># d_ip f(p) -&gt; f(i)</span>
<span class="go">f(_i)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">q</span><span class="p">,</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">))</span>       <span class="c1"># d_qp f(p) -&gt; f(q)</span>
<span class="go">f(_q)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">q</span><span class="p">,</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">q</span><span class="p">))</span>       <span class="c1"># d_qp f(q) -&gt; f(p)</span>
<span class="go">f(_p)</span>
</pre></div>
</div>
<p>More interesting cases:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">t</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="n">i</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">))</span>
<span class="go">f(_i, _q)*t(_a, _i)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">t</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="n">i</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">))</span>
<span class="go">f(_a, _q)*t(_a, _i)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">))</span>
<span class="go">f(_p, _p)</span>
</pre></div>
</div>
<p>Finally, here are some cases where nothing is done, because that would
imply a loss of information:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">q</span><span class="p">))</span>
<span class="go">f(_q)*KroneckerDelta(_i, _p)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evaluate_deltas</span><span class="p">(</span><span class="n">KroneckerDelta</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">i</span><span class="p">))</span>
<span class="go">f(_i)*KroneckerDelta(_i, _p)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.physics.secondquant.matrix_rep">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">matrix_rep</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">op</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">basis</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L1476-L1498"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.matrix_rep" title="Permalink to this definition">¶</a></dt>
<dd><p>Find the representation of an operator in a basis.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">VarBosonicBasis</span><span class="p">,</span> <span class="n">B</span><span class="p">,</span> <span class="n">matrix_rep</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">VarBosonicBasis</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">o</span> <span class="o">=</span> <span class="n">B</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">matrix_rep</span><span class="p">(</span><span class="n">o</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[0, 1,       0,       0, 0],</span>
<span class="go">[0, 0, sqrt(2),       0, 0],</span>
<span class="go">[0, 0,       0, sqrt(3), 0],</span>
<span class="go">[0, 0,       0,       0, 2],</span>
<span class="go">[0, 0,       0,       0, 0]])</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.physics.secondquant.simplify_index_permutations">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">simplify_index_permutations</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">permutation_operators</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L3016-L3106"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.simplify_index_permutations" title="Permalink to this definition">¶</a></dt>
<dd><p>Performs simplification by introducing PermutationOperators where appropriate.</p>
<p class="rubric">Explanation</p>
<dl class="simple">
<dt>Schematically:</dt><dd><p>[abij] - [abji] - [baij] + [baji] -&gt;  P(ab)*P(ij)*[abij]</p>
</dd>
</dl>
<p>permutation_operators is a list of PermutationOperators to consider.</p>
<p>If permutation_operators=[P(ab),P(ij)] we will try to introduce the
permutation operators P(ij) and P(ab) in the expression.  If there are other
possible simplifications, we ignore them.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">Function</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">simplify_index_permutations</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">PermutationOperator</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">,</span><span class="n">r</span><span class="p">,</span><span class="n">s</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p,q,r,s&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;g&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">g</span><span class="p">(</span><span class="n">q</span><span class="p">)</span> <span class="o">-</span> <span class="n">f</span><span class="p">(</span><span class="n">q</span><span class="p">)</span><span class="o">*</span><span class="n">g</span><span class="p">(</span><span class="n">p</span><span class="p">);</span> <span class="n">expr</span>
<span class="go">f(p)*g(q) - f(q)*g(p)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">simplify_index_permutations</span><span class="p">(</span><span class="n">expr</span><span class="p">,[</span><span class="n">PermutationOperator</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">)])</span>
<span class="go">f(p)*g(q)*PermutationOperator(p, q)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">PermutList</span> <span class="o">=</span> <span class="p">[</span><span class="n">PermutationOperator</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">),</span><span class="n">PermutationOperator</span><span class="p">(</span><span class="n">r</span><span class="p">,</span><span class="n">s</span><span class="p">)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">r</span><span class="p">)</span><span class="o">*</span><span class="n">g</span><span class="p">(</span><span class="n">q</span><span class="p">,</span><span class="n">s</span><span class="p">)</span> <span class="o">-</span> <span class="n">f</span><span class="p">(</span><span class="n">q</span><span class="p">,</span><span class="n">r</span><span class="p">)</span><span class="o">*</span><span class="n">g</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">s</span><span class="p">)</span> <span class="o">+</span> <span class="n">f</span><span class="p">(</span><span class="n">q</span><span class="p">,</span><span class="n">s</span><span class="p">)</span><span class="o">*</span><span class="n">g</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">r</span><span class="p">)</span> <span class="o">-</span> <span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">s</span><span class="p">)</span><span class="o">*</span><span class="n">g</span><span class="p">(</span><span class="n">q</span><span class="p">,</span><span class="n">r</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">simplify_index_permutations</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span><span class="n">PermutList</span><span class="p">)</span>
<span class="go">f(p, r)*g(q, s)*PermutationOperator(p, q)*PermutationOperator(r, s)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.physics.secondquant.substitute_dummies">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">substitute_dummies</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">new_indices</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pretty_indices</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">{}</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L2390-L2555"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.substitute_dummies" title="Permalink to this definition">¶</a></dt>
<dd><p>Collect terms by substitution of dummy variables.</p>
<p class="rubric">Explanation</p>
<p>This routine allows simplification of Add expressions containing terms
which differ only due to dummy variables.</p>
<p>The idea is to substitute all dummy variables consistently depending on
the structure of the term.  For each term, we obtain a sequence of all
dummy variables, where the order is determined by the index range, what
factors the index belongs to and its position in each factor.  See
_get_ordered_dummies() for more information about the sorting of dummies.
The index sequence is then substituted consistently in each term.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">Function</span><span class="p">,</span> <span class="n">Dummy</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">substitute_dummies</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span><span class="n">b</span><span class="p">,</span><span class="n">c</span><span class="p">,</span><span class="n">d</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a b c d&#39;</span><span class="p">,</span> <span class="n">above_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="bp">cls</span><span class="o">=</span><span class="n">Dummy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="p">,</span><span class="n">j</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;i j&#39;</span><span class="p">,</span> <span class="n">below_fermi</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="bp">cls</span><span class="o">=</span><span class="n">Dummy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;f&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="n">b</span><span class="p">)</span> <span class="o">+</span> <span class="n">f</span><span class="p">(</span><span class="n">c</span><span class="p">,</span><span class="n">d</span><span class="p">);</span> <span class="n">expr</span>
<span class="go">f(_a, _b) + f(_c, _d)</span>
</pre></div>
</div>
<p>Since a, b, c and d are equivalent summation indices, the expression can be
simplified to a single term (for which the dummy indices are still summed over)</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">substitute_dummies</span><span class="p">(</span><span class="n">expr</span><span class="p">)</span>
<span class="go">2*f(_a, _b)</span>
</pre></div>
</div>
<p>Controlling output:</p>
<p>By default the dummy symbols that are already present in the expression
will be reused in a different permutation.  However, if new_indices=True,
new dummies will be generated and inserted.  The keyword ‘pretty_indices’
can be used to control this generation of new symbols.</p>
<p>By default the new dummies will be generated on the form i_1, i_2, a_1,
etc.  If you supply a dictionary with key:value pairs in the form:</p>
<blockquote>
<div><p>{ index_group: string_of_letters }</p>
</div></blockquote>
<p>The letters will be used as labels for the new dummy symbols.  The
index_groups must be one of ‘above’, ‘below’ or ‘general’.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="n">b</span><span class="p">,</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">my_dummies</span> <span class="o">=</span> <span class="p">{</span> <span class="s1">&#39;above&#39;</span><span class="p">:</span><span class="s1">&#39;st&#39;</span><span class="p">,</span> <span class="s1">&#39;below&#39;</span><span class="p">:</span><span class="s1">&#39;uv&#39;</span> <span class="p">}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">substitute_dummies</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">new_indices</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">pretty_indices</span><span class="o">=</span><span class="n">my_dummies</span><span class="p">)</span>
<span class="go">f(_s, _t, _u, _v)</span>
</pre></div>
</div>
<p>If we run out of letters, or if there is no keyword for some index_group
the default dummy generator will be used as a fallback:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span><span class="n">q</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p q&#39;</span><span class="p">,</span> <span class="bp">cls</span><span class="o">=</span><span class="n">Dummy</span><span class="p">)</span>  <span class="c1"># general indices</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="n">p</span><span class="p">,</span><span class="n">q</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">substitute_dummies</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">new_indices</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">pretty_indices</span><span class="o">=</span><span class="n">my_dummies</span><span class="p">)</span>
<span class="go">f(_p_0, _p_1)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.physics.secondquant.wicks">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.secondquant.</span></span><span class="sig-name descname"><span class="pre">wicks</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">e</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kw_args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/secondquant.py#L2862-L2970"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.secondquant.wicks" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the normal ordered equivalent of an expression using Wicks Theorem.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">Dummy</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.secondquant</span> <span class="kn">import</span> <span class="n">wicks</span><span class="p">,</span> <span class="n">F</span><span class="p">,</span> <span class="n">Fd</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">r</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p,q,r&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wicks</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="n">F</span><span class="p">(</span><span class="n">q</span><span class="p">))</span>
<span class="go">KroneckerDelta(_i, q)*KroneckerDelta(p, q) + NO(CreateFermion(p)*AnnihilateFermion(q))</span>
</pre></div>
</div>
<p>By default, the expression is expanded:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">wicks</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">q</span><span class="p">)</span><span class="o">+</span><span class="n">F</span><span class="p">(</span><span class="n">r</span><span class="p">)))</span>
<span class="go">NO(AnnihilateFermion(p)*AnnihilateFermion(q)) + NO(AnnihilateFermion(p)*AnnihilateFermion(r))</span>
</pre></div>
</div>
<p>With the keyword ‘keep_only_fully_contracted=True’, only fully contracted
terms are returned.</p>
<dl class="simple">
<dt>By request, the result can be simplified in the following order:</dt><dd><p>– KroneckerDelta functions are evaluated
– Dummy variables are substituted consistently across terms</p>
</dd>
</dl>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">r</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;p q r&#39;</span><span class="p">,</span> <span class="bp">cls</span><span class="o">=</span><span class="n">Dummy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wicks</span><span class="p">(</span><span class="n">Fd</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="n">q</span><span class="p">)</span><span class="o">+</span><span class="n">F</span><span class="p">(</span><span class="n">r</span><span class="p">)),</span> <span class="n">keep_only_fully_contracted</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="go">KroneckerDelta(_i, _q)*KroneckerDelta(_p, _q) + KroneckerDelta(_i, _r)*KroneckerDelta(_p, _r)</span>
</pre></div>
</div>
</dd></dl>

</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="sho.html"
                        title="previous chapter">Quantum Harmonic Oscillator in 3-D</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="wigner.html"
                        title="next chapter">Wigner Symbols</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/physics/secondquant.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="wigner.html" title="Wigner Symbols"
             >next</a> |</li>
        <li class="right" >
          <a href="sho.html" title="Quantum Harmonic Oscillator in 3-D"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" >Physics</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Second Quantization</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/physics/secondquant.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:27:49 GMT -->
</html>